package com.taysear.domain;

import java.io.Serializable;

@SuppressWarnings("serial")
public class Substation implements Serializable{

	private Integer substationId;
	private Station station;
	private String code;
	private String name;
	private Integer substationNumber;
	private Integer waybillNumber = 0;
	private StationStatus stationStatus; 
	
	public Integer getSubstationId() {
		return substationId;
	}
	public void setSubstationId(Integer substationId) {
		this.substationId = substationId;
	}
	public Station getStation() {
		return station;
	}
	public void setStation(Station station) {
		this.station = station;
	}
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public Integer getSubstationNumber() {
		return substationNumber;
	}
	public void setSubstationNumber(Integer substationNumber) {
		this.substationNumber = substationNumber;
	}
	public Integer getWaybillNumber() {
		return waybillNumber;
	}
	public void setWaybillNumber(Integer waybillNumber) {
		this.waybillNumber = waybillNumber;
	}
	public StationStatus getStationStatus() {
		return stationStatus;
	}
	public void setStationStatus(StationStatus stationStatus) {
		this.stationStatus = stationStatus;
	}	
	
	@Override
    public String toString() {
        return code + " " + name;
    }
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((code == null) ? 0 : code.hashCode());
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		result = prime * result
				+ ((substationId == null) ? 0 : substationId.hashCode());
		result = prime
				* result
				+ ((substationNumber == null) ? 0 : substationNumber.hashCode());
		result = prime * result
				+ ((waybillNumber == null) ? 0 : waybillNumber.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Substation other = (Substation) obj;
		if (code == null) {
			if (other.code != null)
				return false;
		} else if (!code.equals(other.code))
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		if (substationId == null) {
			if (other.substationId != null)
				return false;
		} else if (!substationId.equals(other.substationId))
			return false;
		if (substationNumber == null) {
			if (other.substationNumber != null)
				return false;
		} else if (!substationNumber.equals(other.substationNumber))
			return false;
		if (waybillNumber == null) {
			if (other.waybillNumber != null)
				return false;
		} else if (!waybillNumber.equals(other.waybillNumber))
			return false;
		return true;
	}
	
}
